package cn.org.timespace.easyframe.service.permission.impl;

import java.util.Date;
import java.util.List;

import cn.org.timespace.easyframe.action.permission.OperationLogModel;
import cn.org.timespace.easyframe.dao.permission.OperationLogDao;
import cn.org.timespace.easyframe.model.permission.EfUser;
import cn.org.timespace.easyframe.model.permission.OperationLog;
import cn.org.timespace.easyframe.service.permission.OperationLogService;
import cn.org.timespace.easyframe.util.generator.IdentityGenerator;
import cn.org.timespace.easyframe.util.pager.Pager;

/**
 * <p>
 * 用户操作日志接口实现类
 * </p>
 * 
 * @version 1.0, 11/02/11
 * @since 1.0
 * @author wubo
 */

public class OperationLogServiceImpl implements OperationLogService {

	private OperationLogDao operationLogDao;

	public List<OperationLog> findByCondition(OperationLogModel model) {
		return operationLogDao.findByCondition(model);
	}
	
	public List<Object> findByCondition(OperationLogModel model, Pager p) {
		return operationLogDao.findByCondition(model, p);
	}

	public void save(OperationLog entity) {
		operationLogDao.save(entity);
	}

	public OperationLogDao getOperationLogDao() {
		return operationLogDao;
	}

	public void setOperationLogDao(OperationLogDao operationLogDao) {
		this.operationLogDao = operationLogDao;
	}

	public void save(String dicMode, String dicFunCode, String operationCode,
			String content, String remark, String userId) {
		
		OperationLog operationLog = new OperationLog();
		operationLog.setOperatorId(IdentityGenerator.getInstance().getId());
		operationLog.setDicModel(dicMode);  //模块
		operationLog.setDicFunCode(dicFunCode); //功能代码
		operationLog.setOperationCode(operationCode); //操作代码
		operationLog.setContent(content); //内容
		EfUser efUser = new EfUser();
		efUser.setUserId(userId);
		operationLog.setEfUser(efUser);
		operationLog.setOperationDate(new Date());
		operationLog.setRemark(remark);
		
		this.save(operationLog);
	}
	
	
}
